#include "trans.h"

namespace sp::Image::Trans{

void registe_trans(){
    trans::registe();
}

trans::trans(std::vector<std::string> v){
    assert(v.size() == 0);
    name = "trans";
    class_name = "Image-Trans-trans";
    data_type_support.push_back(std::pair<std::vector<uint8_t>, uint8_t>({MAT},MAT));
}

trans::trans(){
    name = "trans";
    class_name = "Image-Trans-trans";
    data_type_support.push_back(std::pair<std::vector<uint8_t>, uint8_t>({MAT},MAT));
}

trans::~trans(){

}

void trans::registe(){
    Function::Register("Image-Trans-trans", createObject);
    Function::Register("Image-Trans-trans", createObject2);
}

Function* trans::createObject(std::vector<std::string> params){
    return new trans(params);
}

Function* trans::createObject2(){
    return new trans();
}

void trans::start(){

}

bool trans::waitForResource(){
    return true;
}

void trans::process(std::vector<std::vector<Data*>>& data_input, std::vector<Data*>& data_output){
    // 验证输入个数
    assert(batch_size != 0);
    assert(data_input.size() <= batch_size);
    assert(data_input[0].size() == 1);
    // 处理
    for(int i = 0; i < data_input.size(); i++){
        if(data_input[i][0] == DATA_END)
            break;
        // Trans Function 由于没做任何处理，所以不进行Data内存的销毁和重建。
        data_output.push_back(data_input[i][0]);
    }
}

bool trans::releaseResource(){
    return true;
}

void trans::finish(){
    
}

void trans::copy(Function* other){
    Function::defaultCopy(other);
}

};